#include <stdio.h>
#include <string.h>
#define GET_ARRAY_LEN(array,len) {len=(sizeof(array)/sizeof(array[0]));}
/*最长公共前缀*/

char* maxprefix(char** strs,int strsSize)
{
    int i;
    char *a=strs[0];
    for(i=1;i<strsSize;i++)
    {
        int j=0;
        while((a[j]!=0) && (strs[i][j]!=0) && (a[j]==strs[i][j]))
        {
            j++;
        }
        a[j]='\0';
    }
    return a;
}


void main()
{
    int len;
    char *str1[]={"flower","flow","flight"};
    char* str2[]={"dog","racecar","car"};
    GET_ARRAY_LEN(str1,len)
    char* str=maxprefix(str1,len);
    printf("%s",str);

}